package com.prs.crm.action.flow;

import org.apache.struts2.convention.annotation.Action;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;

import com.prs.crm.context.Constrains;
import com.prs.crm.domain.flow.WorkFlowProcess;
import com.prs.crm.domain.flow.WorkFlowProcessNode;
import com.prs.crm.service.flow.WorkFlowProcessService;

public class FlowHistoryAction extends BaseAction{

	private static final long serialVersionUID = -5274063643081938367L;
	
	private WorkFlowProcessService workflowProcessService;
	
	private PaginationSupport pagination;
	
	private WorkFlowProcess process;

	private WorkFlowProcessNode node;
	

	public void setWorkflowProcessService(WorkFlowProcessService workflowProcessService) {
		this.workflowProcessService = workflowProcessService;
	}

	public WorkFlowProcessService getWorkflowProcessService() {
		return workflowProcessService;
	}
	
	public PaginationSupport getPagination() {
		return pagination;
	}

	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}


	public void setNode(WorkFlowProcessNode node) {
		this.node = node;
	}

	public WorkFlowProcessNode getNode() {
		return node;
	}
	
	public void setProcess(WorkFlowProcess process) {
		this.process = process;
	}

	public WorkFlowProcess getProcess() {
		return process;
	}

	@Action("listHistoryProcessNodes")
	public String listHistoryProcessNodes()
	{
		this.setPagination(this.getWorkflowProcessService()
					.listFlowNodes(this.getPaginationHelper().prepare(pagination), 
							process
							, new Integer[]{Constrains.WORKFLOWPROCESS_STATE_END}));
		return SUCCESS;
	}
	
	@Action("viewNodeDetail")
	public String viewNodeDetail()
	{
		return SUCCESS;
	}


	
	
}
